4 * @covers DnsSrvDiscoverer
6 class DnsSrvDiscovererTest
extends PHPUnit_Framework_TestCase
{
8 use MediaWikiCoversValidator
;
11 * @dataProvider provideRecords
13 public function testPickServer( $params, $expected ) {
14 $discoverer = new DnsSrvDiscoverer( 'etcd-tcp.example.net' );
15 $record = $discoverer->pickServer( $params );
17 $this->assertEquals( $expected, $record );
20 public static function provideRecords() {
25 'target' => 'conf03.example.net',
31 'target' => 'conf02.example.net',
37 'target' => 'conf01.example.net',
44 'target' => 'conf03.example.net',
53 'target' => 'conf03or2.example.net',
59 'target' => 'conf03or2.example.net',
65 'target' => 'conf01.example.net',
71 'target' => 'conf04.example.net',
77 'target' => 'conf05.example.net',
84 'target' => 'conf03or2.example.net',
93 public function testRemoveServer() {
94 $dsd = new DnsSrvDiscoverer( 'localhost' );
98 'target' => 'conf01.example.net',
104 'target' => 'conf04.example.net',
110 'target' => 'conf05.example.net',
116 $server = $servers[1];
120 'target' => 'conf01.example.net',
126 'target' => 'conf05.example.net',
135 $dsd->removeServer( $server, $servers ),
136 "Correct server removed"
140 $dsd->removeServer( $server, $servers ),